﻿using BZOrderPrint.DAL;
using BZOrderPrint.DAL.Entity;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Entity.Migrations;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace BZOrderPrint
{
    public partial class UpdateItem : Form
    {
        public UpdateItem()
        {
            InitializeComponent();
        }
        private BzOrderItemEntity _entity { get; set; }
        private BZContext context;
        public UpdateItem(BzOrderItemEntity entity)
        {
            InitializeComponent();
            _entity = entity;
        }

        private void UpdateItem_Load(object sender, EventArgs e)
        {

            ItemCode.Text = _entity.OrderItem;
            textBox1.Text = _entity.OrderItemCode;
            context = new BZContext(ConfigHelper.ConnString);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBox1.Text))
                MessageBox.Show("请输入条码");
            _entity.OrderItemCode = textBox1.Text;
            context.bzOrderItemEntities.AddOrUpdate(_entity);
            MessageBox.Show("修改成功");
        }
    }
}
